package fjut.acm.coding;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import tk.mybatis.spring.annotation.MapperScan;
import cn.hutool.system.SystemUtil;

@SpringBootApplication
@MapperScan("fjut.acm.coding.mapper")
@Slf4j
public class CodingApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext app = SpringApplication.run(CodingApplication.class, args);
        log.info("【CodingFirst】- Spring初始化成功");
        String url = String.format("http://%s:%s%s",
                SystemUtil.getHostInfo().getAddress(),  // 使用 SystemUtil 工具包获取运行环境的参数
                app.getEnvironment().getProperty("server.port"),
                app.getEnvironment().getProperty("server.servlet.context-path"));
        log.info("【CodingFirst】- 项目启动于 {}", url);
        log.info("【CodingFirst】- 在线API文档于 {}", url + "/swagger-ui.html");
        log.info("【CodingFirst】- Druid后台管理于 {}", url + "/druid");

    }

}
